package com.iloomo.dao.core.impl;

import java.util.Map;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.iloomo.dao.DaoSupport;
import com.iloomo.entity.core.KeyValue;
import com.iloomo.dao.core.KeyValueDao;
import com.iloomo.util.PageData;
import com.iloomo.util.PagerModel;

/** 
 * 说明：表 keyValue数据处理实现类
 * 创建人：system
 * 创建时间：2020-02-13
 * @version
 */
@Repository("keyValueDao")
public class KeyValueDaoImpl implements KeyValueDao{

	@Resource(name = "daoSupport")
	private DaoSupport dao;

	/**新增
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public int save(PageData pd) throws Exception{
		return (Integer)dao.save("keyValueMapper.save", pd);
	}
	
	/**删除
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public int deleteById(PageData pd) throws Exception{
		return (Integer)dao.delete("keyValueMapper.deleteById", pd);
	}
	
	/**修改
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public int updateById(PageData pd) throws Exception{
		return (Integer)dao.update("keyValueMapper.updateById", pd);
	}
	
	/**通过id获取数据
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public Map findById(PageData pd) throws Exception{
		return (Map) dao.findForObject("keyValueMapper.findById", pd);
	}
	
	/**列表(分页)
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public PagerModel list(PageData pd) throws Exception{
		return dao.selectPageList("keyValueMapper.list", "keyValueMapper.listCount", pd);
	}
	
	/**列表(全部)
	 * @param pd
	 * @ throws Exception
	 */
	@Override
	public List<Map> listAll(PageData pd) throws Exception{
		return (List<Map>) dao.findForList("keyValueMapper.listAll",pd);
	}
	/**批量保存
		* @param objs
		* @ throws Exception
	*/
	@Override
	public Object batchSave(List objs) throws Exception {
		return dao.batchSave("keyValueMapper.save",objs);
	}

	/**列表(分页)
		* @param pd
		* @ throws Exception
	*/
	@Override
	public PagerModel listWithLike(PageData pd) throws Exception{
		return dao.selectPageList("keyValueMapper.listWithLike", "keyValueMapper.listCountWithLike", pd);
	}

	/**列表(全部)
		* @param pd
		* @ throws Exception
	*/
	@Override
	public List<Map> listAllWithLike(PageData pd) throws Exception{
		return (List<Map>) dao.findForList("keyValueMapper.listAllWithLike",pd);
	}
	/**获取数量
	* @param pd
	* @ throws Exception
	*/
	@Override
	public int selectCount(PageData pd) throws Exception{
		return  dao.selectCount("orderMainMapper.selectCount",pd);
	}
}

